"""
读写文件
"""

f = open('F:/Temp/123.txt','r',encoding='utf-8' )
print(f.read())
f.close()

with open('F:/Temp/123.txt','r',encoding='utf-8') as f:
    print(f.read())

with open('F:/Temp/123.txt','r',encoding='utf-8') as f:
    for line in f.readlines():
        print(line.strip())

with open('F:/Temp/123.txt','a',encoding='utf-8') as f:
    f.write('\nhello world')

"""
操作文件和目录
"""
import os
print(os.name)

print(os.path.abspath('.'))

# print(os.mkdir('F:/Temp/test123'))
# os.rmdir('F:/Temp/test123')

"""
序列化
"""

import json

d = dict(name='Bob', age=20, score=88)
json_str = json.dumps(d)
print(json_str)

print(json.loads(json_str))